/**
 * [orderFilterParam description]
 * @type {Object}
 */
var employeeStoreListFilterParam = {
    shopId:'',
    shopName:''
};
(function(doc, win) {

    // sui 页面就绪时间
    $(doc).on("pageInit", "#employeeStoreListPage", function(e, pageId, $page, isBack) {
        CommonUtil.render($("#selectEmployeeShopDiv"), "employeeShopTpl", {data: employeeFilterParam.cache});
        $('#employeeStoreListPage .page-body #selectEmployeeShopDiv .store-list li').each(function(){
            var shopId = $(this).attr("shopId");
            if (shopId && shopId == employeeFilterParam.params.shopId) {
                $(this).addClass("selected");
                $('#employeeStoreListPage .scroll-view .check-all').css("color", "#333");
                return;
            } 
        });
        //清空本页存储的数据
        if(employeeFilterParam.params.shopId == '') {
            employeeStoreListFilterParam.shopId = '';
            employeeStoreListFilterParam.shopName = '';
            $('#employeeStoreListPage .scroll-view .check-all').css("color", "#508cee");
        }

    });

    // 选择某个门店
    $(doc).on('click','#employeeStoreListPage .page-body #selectEmployeeShopDiv .store-list li',function(){
        if($(this).is('.mark-reject')){
            return;
        }
        $(".selected").removeClass("selected");
        $(this).addClass("selected");
        $('#employeeStoreListPage .scroll-view .check-all').css("color", "#333");
        employeeStoreListFilterParam.shopId = $(this).attr("shopId");
        employeeStoreListFilterParam.shopName = $(this).attr("shopName");
    });

    // 选择全部
    $(doc).on('click','#employeeStoreListPage .check-all',function(){
        $('#employeeStoreListPage .page-body #selectEmployeeShopDiv .store-list li').removeClass("selected");
        employeeStoreListFilterParam.shopId = '';
        employeeStoreListFilterParam.shopName = '';
        $('#employeeStoreListPage .scroll-view .check-all').css("color", "#508cee");
    });
})(document, window);

